define(function (require, exports, mudule) {
    var Vue = require('vue');
    var welcome = require('./component/welcome');
    var headerArea = require('./component/header-area');
    var contentArea = require('./component/content-area');
    var EventBus = require('./service/event-bus');
    
    new Vue({
        name: 'app',
        el: '#app',
        data() {
            return {
                location: {
                    path: 0,
                    params: 1
                },
                navs: [
                    {
                        title: '文章',
                        link: '/article/1'
                    },
                    {
                        title: '归档',
                        link: '/archives'
                    },
                    {
                        title: '关于',
                        link: '/about'
                    }
                ]
            }
        },
        components: {
            welcome,
            headerArea,
            contentArea
        },
        methods: {
            handleLocationChange(payload) {
                this.location.path = payload.path;
                this.location.params = payload.params;
            }
        },
        created() {
            EventBus.$on('link-changed', this.handleLocationChange);
        }
    });
});